package com;

import com.config.FileterController;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class Demo {

	/**
	 * 代码方式注册Bean
	 * @return
	 */
	//@Bean         使用拦截器时，需接触此注解
	public FilterRegistrationBean setFilter(){

		FilterRegistrationBean filterBean = new FilterRegistrationBean();
		filterBean.setFilter(new FileterController());
		filterBean.setName("FilterController");
		filterBean.addUrlPatterns("/*");
		return filterBean;
	}

	public static void main(String[] args) {
		SpringApplication.run(Demo.class, args);
	}
}
